﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Versioning;
using System.Web;

namespace WS1.Models
{
	public class Products
	{
        [Required(ErrorMessage ="ID不能为空")]
        public int product_id { get; set; }
        [Required(ErrorMessage ="产品名是必须的")]
        [StringLength(100,ErrorMessage ="名称不能超过100个字符")]
        [RegularExpression("^[a-zA-Z]+$", ErrorMessage = "产品名只能包含字母")]
        public string product_name { get; set; }
        public string product_category { get; set; }
        public string ingredients { get; set; }
        [RegularExpression(@"^[0-9]+(\.[0-9]+)?$", ErrorMessage = "只能包含数字")]

        public decimal current_price { get; set; }
        [RegularExpression(@"^[0-9]+(\.[0-9]+)?$", ErrorMessage = "只能包含数字")]

        public decimal production_cost { get; set; }
        public bool is_currently_available { get; set; }
        public bool is_seasonal { get; set; }
        [Required(ErrorMessage = "上市日期是必须的")]
      
        [RegularExpression(@"^\d{4}-\d{2}-\d{2}$", ErrorMessage = "日期格式不正确，应为 yyyy-MM-dd")] // 验证日期格式
        public System.DateTime launch_date { get; set; }
        public string Desciption { get; set; }
    }
}